import { request } from '@/utils/request';

import type { pdfConvertRequest, imgConvertRequest, convertResult } from '@/api/model/docModel';

const Api = {
  PdfToWord: '/doc/convert/pdf2word',
  PdfToExcel: '/doc/convert/pdf2excel',
  PdfToImage: '/doc/convert/pdf2img',
  ImageToPdf: '/doc/convert/img2pdf',
  ImageToWord: '/doc/convert/img2word',
  ImageToExcel: '/doc/convert/img2excel',
  GetConvertResult: '/doc/convert/result',
};

export function pdf2word(d: pdfConvertRequest) {
  return request.post<object>({
    url: Api.PdfToWord,
    data: d,
  });
}
export function pdf2excel(d: pdfConvertRequest) {
  return request.post<object>({
    url: Api.PdfToExcel,
    data: d,
  });
}
export function pdf2img(d: pdfConvertRequest) {
  return request.post<object>({
    url: Api.PdfToImage,
    data: d,
  });
}
export function img2word(d: imgConvertRequest) {
  return request.post<object>({
    url: Api.ImageToWord,
    data: d,
  });
}
export function img2excel(d: imgConvertRequest) {
  return request.post<object>({
    url: Api.ImageToExcel,
    data: d,
  });
}
export function img2pdf(d: imgConvertRequest) {
  return request.post<object>({
    url: Api.ImageToPdf,
    data: d,
  });
}
//查询
export function getConvertResult(Id: string) {
  return request.get<convertResult>({
    url: Api.GetConvertResult + '?Id=' + Id,
  });
}
